﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Tracy.DataModel.UltraExplorer;
using Tracy.DataModel;

namespace Tracy.Plugins.Classifiers.FileClassifiers
{
    public class FanSubGroupFileClassifier : AbstractClassifier<MediaFile>
    {

        protected override List<string> GetCategories(MediaFile file)
        {
            List<string> rtn = new List<string>();
            if (file != null && file.Resource != null && file.Resource.FanSubGroups != null)
            {
                foreach (FanSubGroup fsg in file.Resource.FanSubGroups)
                {
                    rtn.Add(fsg.Name);
                }
            }
            return rtn;
        }

        public override bool MatchCategory(MediaFile item, string key)
        {
            if (item != null && item.Resource != null && item.Resource.FanSubGroups != null)
            {
                foreach (FanSubGroup fsg in item.Resource.FanSubGroups)
                {
                    if(String.Equals(fsg.Name, key, StringComparison.OrdinalIgnoreCase))return true;
                }
            }
            return false;
        }
    }


}
